import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int F = in.nextInt();
        int V = in.nextInt();
        int[][] arr = new int[F][];

        for(int i = 0; i < F; i++){
            for (int j = 0; j < V; j++) {
                arr[i][j] = in.nextInt();
            }
        }

        

    }
    public static void main1(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        while(k-->0){
            int x = in.nextInt();
            int y = in.nextInt();

            String str = in.nextLine();
            char[] ch = str.toCharArray();

            int length = str.length();

            for(int i = 1; i < length; i++){
                if(ch[i] == 'f' && y+1 <= n && y+1 >= 1){
                    y++;
                }else if(ch[i] == 'b' && y-1 <= n && y-1 >= 1){
                    y--;
                }else if(ch[i] == 'r' && x+1 <= n && x+1 >= 1){
                    x++;
                }else if(ch[i] == 'l' && x-1 <= n && x-1 >= 1){
                    x--;;
                }
            }

            System.out.println(x + " " + y);
        }
    }
}
